const express = require('express');
const router = new express.Router();

/**
 * @param {Object} options
 * @param {} options.code 编号
 * @param {} options.name 名称
 * @param {} options.partCategoryId 备件分类Id
 * @param {} options.status 状态
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        partCategoryId: req.query.partCategoryId,
        status: req.query.status,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id313',
                    code: 'code314',
                    name: 'name315',
                    description: 'description',
                    length: 1,
                    width: 1,
                    height: 1,
                    netWeight: 1,
                    grossWeight: 1,
                    unit: 'unit',
                    usagePerCar: 'usagePerCar',
                    minPackSize: 1,
                    partReplacementCode: 'partReplacementCode316',
                    status: 1,
                    rowVersion: 'rowVersion',
                    options: [
                        'update',
                        'batchCategory',
                    ]
                },
                {
                    id: 'id317',
                    code: 'code318',
                    name: 'name319',
                    description: 'description',
                    length: 1,
                    width: 1,
                    height: 1,
                    netWeight: 1,
                    grossWeight: 1,
                    unit: 'unit',
                    usagePerCar: 'usagePerCar',
                    minPackSize: 1,
                    partReplacementCode: 'partReplacementCode320',
                    status: 1,
                    rowVersion: 'rowVersion',
                    options: [
                        'batchCategory',
                        'update'
                    ]
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id 备件服务属性Id
 * @throws {Error}
 * @return {Promise}
 */
router.get('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message',
        payload: {
            id: 'id321',
            code: 'code322',
            name: 'name323',
            description: 'description',
            partCategory: 'partCategory',
            length: 1,
            width: 1,
            height: 1,
            netWeight: 1,
            grossWeight: 1,
            productCategoryCode: 'productCategoryCode324',
            partReplacementCode: 'partReplacementCode325',
            alternativePlan: 'alternativePlan',
            supplierCode: 'supplierCode326',
            unit: 'unit',
            certificationMark: 'certificationMark',
            minPackSize: 1,
            minOrderQuantity: 1,
            usagePerCar: 'usagePerCar',
            isConsume: true,
            isDecimalAllowed: true,
            overseaOnly: 'overseaOnly',
            shelfLife: 'shelfLife',
            safeMaterial: 'safeMaterial',
            packageRule: 'packageRule',
            isImported: true,
            remark: 'remark',
            status: 1,
            rowVersion: 'rowVersion',
            options: [
                'batchCategory',
                'update'
            ],
            partWarrantyCategoryId: 'partWarrantyCategoryId327',
            partWarrantyCategoryCode: 'partWarrantyCategoryCode328',
            partWarrantyCategoryName: 'partWarrantyCategoryName329',
            isPreAuthorized: true,
            isNeedPicture: true,
            partServiceProperties: [
                {
                    id: '1',
                    brandId: 'id1',
                    brandCode: 'code2',
                    brandName: 'name3',
                    dealerId: 'id4',
                    dealerCode: 'code5',
                    dealerName: 'name6',
                    partWarrantyCategoryId: 'id4',
                    partWarrantyCategoryCode: 'code5',
                    partWarrantyCategoryName: 'name6',
                    isPreAuthorized: true
                },
                {
                    id: '2',
                    brandId: 'id4',
                    brandCode: 'code5',
                    brandName: 'name6',
                    dealerId: 'id4',
                    dealerCode: 'code5',
                    dealerName: 'name6',
                    partWarrantyCategoryId: 'id4',
                    partWarrantyCategoryCode: 'code5',
                    partWarrantyCategoryName: 'name6',
                    isPreAuthorized: false
                }
            ],
            partServicePrices: [
                {
                    id: '1',
                    brandId: 'id1',
                    brandCode: 'code2',
                    brandName: 'name3',
                    year: 'year',
                    month: 'month',
                    currency: 1,
                    price: 1,
                    priceType: 1
                },
                {
                    id: '2',
                    brandId: 'id4',
                    brandCode: 'code5',
                    brandName: 'name6',
                    year: 'year',
                    month: 'month',
                    currency: 2,
                    price: 2,
                    priceType: 2
                }
            ],
            partDutyUnits: [
                {
                    dutyUnitId: 'dutyUnitId333',
                    dutyUnitCode: 'dutyUnitCode334',
                    dutyUnitName: 'dutyUnitName335',
                    isDefault: true
                },
                {
                    dutyUnitId: 'dutyUnitId336',
                    dutyUnitCode: 'dutyUnitCode337',
                    dutyUnitName: 'dutyUnitName338',
                    isDefault: false
                }
            ]
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id 备件服务属性Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.put('/batchCategory', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
module.exports = router;
